#pragma once
#include "mkvstream.hpp"
//#include <list>

namespace MkvMux
{

class MkvStreamVideo : public MkvStream
{
    MkvStreamVideo(const MkvStreamVideo&);
    MkvStreamVideo& operator=(const MkvStreamVideo&);
    
protected:
    MkvStreamVideo(MkvContext&, const AM_MEDIA_TYPE&);
    ~MkvStreamVideo();

    void WriteTrackType();
    
public:
    void Flush();
    bool Wait() const;

    class VideoFrame : public Frame
    {
        VideoFrame(const VideoFrame&);
        VideoFrame& operator=(const VideoFrame&);

    protected:
        VideoFrame();

    public:
        void Write(const MkvStream&, ULONG cluster_timecode_ms) const;
        virtual bool IsKey() const = 0;
        
    };
    
    virtual LONG last_timecode_ms() const = 0;

    typedef std::list<VideoFrame*> frames_t;    
    frames_t& GetFrames();
    frames_t& GetKeyFrames();
    
protected:
    frames_t m_vframes;
    frames_t m_rframes;    
    AM_MEDIA_TYPE m_mt;     

    const BITMAPINFOHEADER& GetBitmapInfoHeader() const;
    float GetFramerate() const;

};

} //end namespace MkvMux
